function showInformTemplateSearch(){
	window.location.href="showInformTemplateSearch.do";
}

function ajaxFindInformTemplateSearchList(currentPage,pageSize) {
	$.ajax({
		type:"post",
		url: "ajaxInformTemplateSearchList.do",
		data:{
			groupname:$("#txtIFTroupName").val(),
			currentPage:currentPage,
			pageSize:pageSize,
			orderBy:"id",
		},
		success:function(msg){
			$("#listInformTemplateBox").html(msg);
		}
	});
}

function ajaxShowInformTemplateEdit(id){
	$.ajax({
		type:"post",
		url:"ajaxShowInformTemplateEdit.do",
		data:{informTemplateId:id},
		success:function(msg){
			$("#dialog").html(msg);
			$("#dialog").dialog({
				autoOpen: true,
				width: 800,
				title:$(".dialogtitle").attr("title"),
				modal: true,
				buttons : [{
					text : "保存",
					click : function() {
						ajaxSaveInformTemplate(this);
					}
				}, {
					text : "关闭",
					click : function() {
						$(this).dialog("close");
					}
				}]
			});
		}
	});
}

function ajaxSaveInformTemplate(objDialog) {
	informTemplateValidate();
	if ($("#frmInformTemplate").valid()) {
		$(objDialog).dialog("close");
		var options ={
				type: "post",
				url : "ajaxSaveInformTemplate.do",
				success: function () {
					clearInput("#sltInformTemplate");
					ajaxFindInformTemplateSearchList(1);
					showMessageDialog("保存告知模板","告知模板信息保存成功。",null,dialogType.info);
				}
		};
		var i = 0;
		$("#vehicleDialog tbody input[type='hidden']").each(
				function () {$(this).attr("name","illegalVehicleInfoList["+ i++ +"].id");}
		);
		$("#frmInformTemplate").ajaxSubmit(options);
	}
}

function ajaxShowInformTemplateView(id){
	$.ajax({
		type:"post",
		url:"ajaxShowInformTemplateView.do",
		data:{id:id},
		success:function(msg){
			$("#dialog").html(msg);
			$("#dialog").dialog({
				autoOpen: true,
				width:800,
				title:$(".dialogtitle").attr("title"),
				modal: true,
				buttons : [ {
					text : "关闭",
					click : function() {
						$(this).dialog("close");
					}
				} ]
			});
		}
	});
}

function ajaxDeleteInformTemplateById(id) {
	var informTemplateIds="";
	var sltIFT = $("#listInformTemplateList tbody input:checked").length;
	if(id==null){
		$("#listInformTemplateList tbody input:checked").each(function(){ 
			informTemplateIds += $(this).val()+";";
		});
		if (informTemplateIds == ""){
			showMessageDialog("提示","请选择一行或多行",null,dialogType.info);
			return;
		}else{
			informTemplateIds=informTemplateIds.substring(0, informTemplateIds.length-1);
		}
	}else{
		informTemplateIds=id;
		sltIFT = 1;
	}
	if (informTemplateIds!=null) {
		showMessageDialog("删除告知模板","确定要删除所选“"+sltIFT+"”条告知模板吗？",
				function () {
			$.ajax({					
				type:"post",
				url:"ajaxDeleteInformTemplateByIds.do",
				data:{informTemplateIds:informTemplateIds},
				success:function(msg){
					ajaxFindInformTemplateSearchList();
					showMessageDialog("提示","告知模板删除成功",null,dialogType.info);
				}
			});}
		,dialogType.warning);
	} 
}





